import { BaseWindow } from "../../../../component/window/BaseWindow";
import { ILayer } from "../../../../mvc/interfaces/ILayer";
import { Language } from "../../../../../extend/language/Language";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { KeyBoardManager } from "../../../../../com/gengine/keyBoard/KeyBoardManager";
import { ObjCreate } from "../../common/ObjCreate";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../resource/ResFileConst";
import { EatBeansBonusCellReander } from "./EatBeansBonusCellReander";
import { ImagesConst } from "../../../resource/ImagesConst";
import { Cache } from "../../../cache/Cache";
import { GameProxy } from "../../../mvc/GameProxy";
import { BaseItem } from "../../common/BaseItem";
import { ItemData } from "../../../resource/info/ItemData";
import { ConstConfig } from "../../../resource/ConstConfig";
import { FlyToNavbarTool } from "../../award/FlyToNavbarTool";
import { GTileList } from "../../../../../com/mui/controls/GTileList";
type int = number;
//class EatBeansBonusWin
    
    export  class EatBeansBonusWin extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            setSize(531, 465);
            this.title = Language.getString(80379);
            this.titleHeight = 27;
            return;
        }

        public updateData(arg1: DataProvider, arg2: DataProvider): void
        {
            this._list1.dataProvider = arg2;
            this._list1.drawNow();
            this._list2.dataProvider = arg1;
            this._list2.drawNow();
            return;
        }

        public /* override */ show(arg1: int=0, arg2: int=0): void
        {
            super.show();
            KeyBoardManager.instance.cancelListener();
            this.enableOtherLayer = false;
            this._timerOut = flash.utils.setTimeout(this.timeAutoOut, 10000);
            return;
        }

        public /* override */ hide(): void
        {
            super.hide();
            KeyBoardManager.instance.addListener();
            this.enableOtherLayer = true;
            if (this._timerOut != 0) 
            {
                flash.utils.clearTimeout(this._timerOut);
                this._timerOut = 0;
            }
            return;
        }

        /* internal  */set enableOtherLayer(arg1: Boolean)
        {
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(17, 37, 498, 236, this);
            ObjCreate.createBg(17, 276, 498, 135, this);
            var loc1=ObjCreate.createGButton(Language.getString(30151), 232, 424, 68, 25, this);
            loc1.addEventListener(flash.events.MouseEvent.CLICK, this.clickGetBonusHandler);
            var loc2=ObjCreate.createGTextField("", 394, 431, 150, 20, this);
            loc2.htmlText = Language.getString(80376);
            LoaderHelp.addResCallBack(ResFileConst.EatBeans, this.resGotHandler);
            this._list1 = ObjCreate.createTileList(23, 73, 490, 200, this);
            this._list1.rowHeight = 100;
            this._list1.columnWidth = 243;
            this._list1.setStyle("cellRenderer", EatBeansBonusCellReander);
            this._list2 = ObjCreate.createTileList(23, 313, 490, 210, this);
            this._list2.rowHeight = 100;
            this._list2.columnWidth = 243;
            this._list2.setStyle("cellRenderer", EatBeansBonusCellReander);
            return;
        }

        /* internal  */resGotHandler(): void
        {
            ObjCreate.createBitmap(ImagesConst.EatBeansBeansThiefC, 18, 277, this);
            ObjCreate.createBitmap(ImagesConst.EatBeansDouJiangHun2, 18, 38, this);
            return;
        }

        /* internal  */clickGetBonusHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (Cache.instance.copy.isInEatBeansCopy()) 
            {
                GameProxy.copy.leftEatBeans();
            }
            this.hide();
            return;
        }

        /* internal  */timeAutoOut(): void
        {
            this._timerOut = 0;
            if (Cache.instance.copy.isInEatBeansCopy()) 
            {
                GameProxy.copy.leftEatBeans();
            }
            return;
        }

        /* internal  */showFly(): void
        {
            var loc1=new BaseItem();
            loc1.itemData = new ItemData(ConstConfig.instance.getValueByName("EUpdateCodeEatBeans"));
            FlyToNavbarTool.flyToBackPack(loc1.bitmapdata, new Object /* flash.geom.Point */(this.x + 50, this.y + 50));
            return;
        }

        /* internal */ /* var */_list1: GTileList;

        /* internal */ /* var */_list2: GTileList;

        /* internal */ /* var */_timerOut: int;

        /* internal */ /* var */_timerFly: int;
    }
